home *** CD-ROM | disk | FTP | other *** search
- @if-using not(ocl-file-wordmacs)
- @use (ocl-file-wordmacs)
- ;OCL{{{}}}
- ;OCL{{{ libs
- @if-using not(ocl-file-error) @lib error @fi
- ;OCL}}}
- ;OCL{{{ character-classes
- (defset word-char ( alpha digit ))
- ;OCL}}}
-
- ;OCL{{{ backward-word move one word left
- ;OCL{{{ word-line-up go to end of previous line for word
- (defmac word-line-up (
- if test-top ( failed ) fi
- previous-line
- end-of-line
- ))
- ;OCL}}}
- ;OCL{{{ blank-left skip the whitespace left to next word
- (defmac blank-left (
- while not(test-char-set word-char)
- ;OCL{{{ back or line up
- ( if =(+(store-pos -1) 0)
- ( word-line-up )
- else
- ( backward-character )
- fi
- )
- ;OCL}}}
- ))
- ;OCL}}}
- ;OCL{{{ start-word move to start of current word
- (defmac start-word (
- ;OCL{{{ skip word to next space
- while test-char-set word-char
- ( if test-begin-line
- ( return-from-macro )
- else
- ( backward-character )
- fi
- )
- ;OCL}}}
- forward-character
- ))
- ;OCL}}}
-
- (deffun backward-word (
- if in-prompt ( return-from-macro ) fi
- ;OCL{{{ one step left
- if test-begin-line
- ( word-line-up )
- else
- ( backward-character )
- fi
- ;OCL}}}
- blank-left
- start-word
- ))
- ;OCL}}}
- ;OCL{{{ forward-word move to next word right
- ;OCL{{{ word-line-down go to beginning of next line for word
- (defmac word-line-down (
- if test-bottom ( failed ) fi
- next-line
- beginning-of-line
- ))
- ;OCL}}}
- ;OCL{{{ blank-right skip the whitespace right to next word
- (defmac blank-right (
- while not(test-char-set word-char)
- ;OCL{{{ right or down
- ( if test-end-line
- ( word-line-down )
- else
- ( forward-character )
- fi
- )
- ;OCL}}}
- ))
- ;OCL}}}
- ;OCL{{{ end-word skip to whitespace after current word
- (defmac end-word (
- while test-char-set word-char
- ( forward-character )
- ))
- ;OCL}}}
-
- (deffun forward-word (
- if in-prompt ( return-from-macro ) fi
- ;OCL{{{ end word or next-line
- if test-end-line
- ( word-line-down )
- else
- ( end-word )
- fi
- ;OCL}}}
- blank-right
- ))
- ;OCL}}}
-
- ;OCL{{{ case-word-capitalize capitalize current (or next) word
- (deffun case-word-capitalize (
- if in-prompt ( return-from-macro ) fi
- ;OCL{{{ check position
- if or(test-view,and(test-top =(set-enter 0)))
- ( failed )
- fi
- ;OCL}}}
- ;OCL{{{ maybe move to next word
- if not(test-char-set word-char)
- ( forward-word )
- fi
- ;OCL}}}
- ;OCL{{{ capitalize first char
- if test-char-set lower (case-character-toggle ) fi
- forward-character
- ;OCL}}}
- ;OCL{{{ all following word-chars to lowercase
- while test-char-set word-char
- ( if test-char-set upper ( case-character-toggle ) fi
- forward-character
- )
- ;OCL}}}
- ))
- ;OCL}}}
- ;OCL{{{ case-word-upper all chars of current (or next) word to uppercase
- (deffun case-word-upper (
- if in-prompt ( return-from-macro ) fi
- ;OCL{{{ check position
- if or(test-view and(test-top =(set-enter 0)))
- ( failed )
- fi
- ;OCL}}}
- ;OCL{{{ maybe move to next word
- if not(test-char-set word-char)
- ( forward-word )
- fi
- ;OCL}}}
- ;OCL{{{ all chars to uppercase
- do
- ( if test-char-set lower ( case-character-toggle ) fi
- forward-character
- )
- while test-char-set word-char
- ;OCL}}}
- ))
- ;OCL}}}
- ;OCL{{{ case-word-lower all chars of current (or next) word to lowercase
- (deffun case-word-lower (
- if in-prompt ( return-from-macro ) fi
- ;OCL{{{ check position
- if or(test-view,and(test-top =(set-enter 0)))
- ( failed )
- fi
- ;OCL}}}
- ;OCL{{{ maybe move to next word
- if not(test-char-set word-char)
- ( forward-word )
- fi
- ;OCL}}}
- ;OCL{{{ all chars to lowercase
- do
- ( if test-char-set upper ( case-character-toggle ) fi
- forward-character
- )
- while test-char-set word-char
- ;OCL}}}
- ))
- ;OCL}}}
- ;OCL{{{ undeclares
- ( undeclare
- ( word-line-up
- blank-left
- start-word
- word-line-down
- blank-right
- end-word
- )
- )
- ;OCL}}}
- @fi
-